# Copyright (c) 2024-2025, NVIDIA CORPORATION.

from rmm import DeviceBuffer
from rmm.mr import DeviceMemoryResource
from rmm.pylibrmm.stream import Stream

from pylibcudf.gpumemoryview import gpumemoryview
from pylibcudf.table import Table

class PackedColumns:
    def __init__(self): ...
    def release(self) -> tuple[memoryview[bytes], gpumemoryview]: ...

def pack(input: Table) -> PackedColumns: ...
def unpack(input: PackedColumns) -> Table: ...
def unpack_from_memoryviews(
    metadata: memoryview[bytes], gpu_data: gpumemoryview
) -> Table: ...

class ChunkedPack:
    def __init__(self): ...
    @staticmethod
    def create(
        input: Table,
        user_buffer_size: int,
        stream: Stream,
        temp_mr: DeviceMemoryResource,
    ) -> ChunkedPack: ...
    def has_next(self) -> bool: ...
    def get_total_contiguous_size(self) -> int: ...
    def next(self, buf: DeviceBuffer) -> int: ...
    def build_metadata(self) -> memoryview[bytes]: ...
    def pack_to_host(
        self, buf: DeviceBuffer
    ) -> tuple[memoryview[bytes], memoryview[bytes]]: ...
